using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MeetingRoom.Domain;

public partial class Invite : System.Web.UI.Page
{
    protected List<string> attendees = null;

    public Invite()
    {
        this.attendees = new List<string>();
    }

    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void ButtonAdd_Click(object sender, EventArgs e)
    {
        this.ListBoxAttendees.Items.Add(this.TextBoxEnterpriseId.Text);
    }

    protected void ButtonNext_Click(object sender, EventArgs e)
    {
        Session["attendees"] = (IList) this.ListBoxAttendees.Items;
        MeetingRoom.Domain.Schedule schedule = 
            (MeetingRoom.Domain.Schedule) Session["schedule"];
        if(schedule == null)
        {
            throw new Exception("Cannot find Schedule");
        }

        foreach (ListItem item in this.ListBoxAttendees.Items)
        {
            Staff attendee = null;
            //MeetingRoom.Service.ServiceCentre.GetStaffByEmail(item.Text);
            if (attendee == null)
            {

            }

            MeetingRoom.Service.ServiceCentre.AddAttendee(schedule, attendee);
        }
        Response.Redirect("File.aspx");
    }
    
    protected void ButtonFinish_Click(object sender, EventArgs e)
    {
        Response.Redirect("Finish.aspx");
    }
}
